package com.seefly.firstmall.util;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.seefly.firstmall.entity.Brand;
import com.seefly.firstmall.service.IBrandService;

@Component
public class MenuUtil implements InitializingBean {

	private static List<Brand> tempMenu = new ArrayList<Brand>();

	@Autowired
	private IBrandService brandService;

	@Override
	public void afterPropertiesSet() throws Exception {
		if (tempMenu.size() == 0) {
			tempMenu.addAll(brandService.getAllBrand());
		}
	}

	public static List<Brand> getTempMenu() {
		return tempMenu;
	}

	public static void setTempMenu(List<Brand> tempMenu) {
		MenuUtil.tempMenu = tempMenu;
	}

}
